package com.bestom.bluetoothlock;

import android.app.Application;

import com.bestom.bluetoothlock.bluetooth.BleServiceManage;
import com.bestom.bluetoothlock.util.CurrencyDataManage;
import com.bestom.bluetoothlock.util.SharedPrefrencesHelper;

public class LockApplication extends Application {

    public static LockApplication application;
    private static SharedPrefrencesHelper sharedPrefrencesHelper;
    @Override
    public void onCreate() {
        super.onCreate();
        application = this;
        CurrencyDataManage.getInstance().init(getApplicationContext());
        initBleManage();
    }

    private void initBleManage() {
        BleServiceManage.getInstance(getApplicationContext()).init();
    }

    public static LockApplication getApplication(){
        return application;
    }

    public static synchronized SharedPrefrencesHelper getSharedPreferencesHelper() {
        synchronized (LockApplication.class) {
            if (sharedPrefrencesHelper == null) sharedPrefrencesHelper = new SharedPrefrencesHelper(application);
        }
        return sharedPrefrencesHelper;
    }

}
